<!DOCTYPE html>
<html lang="ch-CN">
<head>
    <meta charset="UTF-8">
    <title>返回值</title>
</head>
<style>
    body {
        width: 100%;
        height: 100vh;
        background-color: wheat;
        font-size: 30px;
        text-decoration: none;
        font-family: "华文楷体";
    }
</style>
<script>
    //一： 返回一个数值
    function sum(a, b, c) {
        return a + b + c;
    }

    let result = sum(2, 3, 4);
    document.write("返回一个数值:" + "<br>")
    document.write("2,3,4的和是:" + result)

    // 二：返回一个对象
    function fun() {
        let obj = {
            name: "小明"
        }
        return obj
    }

    let result1 = fun()
    let result2 = fun().name
    document.write("<br><br>" + "返回一个对象:")
    document.write("<br>" + result1 + result2)

    //四： 返回值时函数
    function fun1() {
        function fun2() {
            document.write("<br><br>" + "返回一个函数:")
            document.write("<br>" + "我是返回的函数")
        }

        return fun2();
    }

    fun1();

</script>
<body>
</body>
</html>